<!DOCTYPE html>
<html>
	<head lang="en">
		<meta charset="utf-8" />
		<title>个人信息</title>
		<link rel="stylesheet" type="text/css" href="css/public.css"/>
		<link rel="stylesheet" type="text/css" href="css/myorder.css"/>
		<script src="X-admin/lib/layui/layui.js"></script>
		<script src="X-admin/js/jquery.js"></script>
		<script src="X-admin/js/xadmin.js"></script>
		<link rel="stylesheet" href="X-admin/css/xadmin.css">
		<script src="js/common.js"></script>
	</head>
	<body>
		<!------------------------------head------------------------------>
		<div class="head" id="top"></div>
		<!------------------------------idea------------------------------>
		<div class="address mt" id="add">
			<div class="wrapper clearfix">
				<a href="index.html" class="fl">首页</a>
				<span>/</span>
				<a href="lessors-mygrxx.html" class="on">个人中心</a>
			</div>
		</div>

		<!------------------------------Bott------------------------------>
		<div class="Bott">
			<div class="wrapper clearfix">
				<div class="zuo fl">
					<h3>
						<a href="#"><img src="img/default.jpeg" style="width: 100px;height: 100px;border-radius:60%" id="zuo-head"/></a>
						<p class="clearfix"><span class="fl" id="name">[羊羊羊]</span><span class="fr">[退出登录]</span></p>
					</h3>
					<ul class="layui-nav layui-nav-tree" lay-filter="test">
						<li class="layui-nav-item">
							<a href="javascript:;" style="color: black;font-weight: bold">帐户管理</a>
							<dl class="layui-nav-child">
								<dd><a href="lessors-mygrxx.html">个人信息</a></dd>
								<dd><a href="lessors-remima.html">修改密码</a></dd>
							</dl>
						</li>
						<li class="layui-nav-item">
							<a href="javascript:;" style="color: black;font-weight: bold">财务中心</a>
							<dl class="layui-nav-child">
								<dd><a href="lessors-fiance.html">财务细明</a></dd>
								<dd><a href="lessors-fiance-dailyList.html">日报</a></dd>
								<dd><a href="lessors-fiance-monthlyList.html">月报</a></dd>
							</dl>
						</li>
						<li class="layui-nav-item">
							<a href="javascript:;" style="color: black;font-weight: bold">个人中心</a>
							<dl class="layui-nav-child">
								<dd><a href="lessors-station.html">我的工位</a></dd>
								<dd><a href="lessors-order-completed.html">工位订单</a></dd>
								<dd><a href="lessors-mygxin.html">我的活动</a></dd>
							</dl>
						</li>
					</ul>
				</div>


				<div class="you fl">
					<div class="my clearfix">
						<h2 class="fl">工位订单信息</h2>
						<a href="#" class="fl">合理出租，了解更多&gt;</a>
					</div>
					<div class="dlist clearfix">
						<ul class="fl clearfix" id="wa">
							<li class="on"><a href="lessors-order-completed.html">已完成</a></li>
							<li><a href="lessors-order-underway.html">使用中</a></li>
							<li><a href="lessors-order-invalid.html">已失效</a></li>
						</ul>
					</div>

					<div id="orderList"></div>
                    <div class="layui-card-body ">
                        <div class="page" id="page"></div>
                    </div>
				</div>
			</div>
		</div>

		<!--返回顶部-->
		<div class="gotop">
			<a href="cart.html">
			<dl>
				<dt><img src="img/gt1.png"/></dt>
				<dd>去购<br />物车</dd>
			</dl>
			</a>
			<a href="#" class="dh">
			<dl>
				<dt><img src="img/gt2.png"/></dt>
				<dd>联系<br />客服</dd>
			</dl>
			</a>
			<a href="lessors-mygrxx.html">
			<dl>
				<dt><img src="img/gt3.png"/></dt>
				<dd>个人<br />中心</dd>
			</dl>
			</a>
			<a href="#" class="toptop" style="display: none">
			<dl>
				<dt><img src="img/gt4.png"/></dt>
				<dd>返回<br />顶部</dd>
			</dl>
			</a>
			<p>400-800-8200</p>
		</div>
		<div class="footer" id="foot"></div>

		<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/public.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/user.js" type="text/javascript" charset="utf-8"></script>

	</body>

	<script>
        // var curPage = 1;
        // var pageSize = 4;
		var Address_Prefix_Lessors = "http://localhost:9200/api-lessors";

		layui.use('laypage',function () {
			var laypage = layui.laypage;
			var busiid = sessionStorage.getItem("busiid");
			laypage.render({
				elem: 'page'
				, count: getCompletedCount(busiid)
				, limit: 4
				, layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
				, jump: function (obj) {
					console.log(obj);
					curPage = obj.curr;
					pageSize = obj.limit;
					getCompleted(busiid)
				}
			});
		});
		//已完成订单数据页面显示
		function setCompleted(data) {
			console.log("shuju:",data);
			var html = '';
			for (i=0 ; i<data.length ; i++) {
				html += '<div class="dkuang">\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t<p class="one">有效订单</p>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t<div class="word clearfix">\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t<ul class="fl clearfix">\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li>'+data[i].crdate+'</li>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li>'+data[i].userna+'</li>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li>订单号:'+data[i].orcode+'</li>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t\t<li>在线支付</li>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t</ul>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t<p class="fr">订单金额：<span>'+data[i].prices+'</span>元</p>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t</div>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t<div class="shohou clearfix">\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t<a href="#" class="fl"><img src="'+data[i].topimg+'" alt=""/></a>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t<p class="fl"><a href="#">'+data[i].stname+'</a><a href="#">工位类型：'+data[i].sttype+'</a><a href="#">¥'+data[i].unitpr+'×'+data[i].letime+'(小时)</a><a href="#">折扣：'+data[i].reduce+'</a></p>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t<p class="fr">\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href="myprod.html">待回复</a>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href="orderxq.html">订单详情</a>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t\t</p>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t\t</div>\n' +
						'\t\t\t\t\t\t\t\t\t\t\t</div>'
			}
			$("#orderList").html(html)
		}
		//获得已完成订单数据
		function getCompleted(busiid) {
			var result = [];
			$.ajax({
				url: Address_Prefix_Lessors + '/order/getOrder/completed',//地址：访问后台的地址
				data: {
					id:busiid,
					page:curPage,
					limit:pageSize
				},//前端传递给后台的数据
				type: 'get',
				async: false,
				dataType: 'json',//是后端传递到前端的数据格式
				success: function (data) {//后端给前端的一个反馈
					console.log("数据：",data.data);
					result = data.data;
					setCompleted(data.data)
				}
			});
			return result
		}
		//获得已完成订单数据Count
		function getCompletedCount(busiid) {
			var count = 0;
			$.ajax({
				url: Address_Prefix_Lessors + '/order/getOrder/completedCount',//地址：访问后台的地址
				data: {
					id:busiid
				},//前端传递给后台的数据
				type: 'get',
				async: false,
				dataType: 'json',//是后端传递到前端的数据格式
				success: function (data) {//后端给前端的一个反馈
					console.log("Count：",data.data);
					count = data.data;
				}
			});
			return count
		}
	</script>
</html>
